home *** CD-ROM | disk | FTP | other *** search
Text File | 1999-06-25 | 3.0 KB | 113 lines | [TEXT/CWIE] |
- // ===========================================================================
- // CPigLatinBehavior.cp ©1999 Eric Traut
- // ===========================================================================
-
- #include "CPigLatinBehavior.h"
- #include "CShadowWindow.h"
-
- #include <UMemoryMgr.h>
-
- // ---------------------------------------------------------------------------
- // • CPigLatinBehavior
- // ---------------------------------------------------------------------------
-
- CPigLatinBehavior::CPigLatinBehavior(
- CShadowWindow & inShadowWindow)
- : COffscreenBehavior(inShadowWindow, true)
- {
- }
-
-
- // ---------------------------------------------------------------------------
- // • RenderToGWorld
- // ---------------------------------------------------------------------------
-
- Boolean
- CPigLatinBehavior::RenderToGWorld(
- StGWorldLocker & inBackingLocker,
- StGWorldLocker & inRenderingLocker)
- {
- COffscreenBehavior::RenderToGWorld(inBackingLocker, inRenderingLocker);
-
- return true;
- }
-
-
- // ---------------------------------------------------------------------------
- // • ConvertTextToPigLatin
- // ---------------------------------------------------------------------------
-
- void
- CPigLatinBehavior::ConvertTextToPigLatin(
- const char * inTextBuf,
- UInt32 inByteCount,
- Handle outPigLatin)
- {
- ::SetHandleSize(outPigLatin, inByteCount);
- ThrowIfMemError_();
-
- // fix me - need to finish
- ::BlockMoveData(inTextBuf, *outPigLatin, inByteCount);
-
- if (inByteCount > 0)
- outPigLatin[0][0] = 'a';
- }
-
-
- // ---------------------------------------------------------------------------
- // • DoQDText
- // ---------------------------------------------------------------------------
-
- void
- CPigLatinBehavior::DoQDText(
- CGrafPtr inOrigPort,
- short inByteCount,
- Ptr inTextBuf,
- Point inNumer,
- Point inDenom)
- {
- StHandleBlock pigLatinText(0, true, true);
- ConvertTextToPigLatin(inTextBuf, inByteCount, pigLatinText);
- {
- StHandleLocker locker(pigLatinText);
- UInt32 newByteCount = ::GetHandleSize(pigLatinText);
- COffscreenBehavior::DoQDText(inOrigPort, newByteCount, *pigLatinText, inNumer, inDenom);
- }
- }
-
-
- // ---------------------------------------------------------------------------
- // • DoQDTxMeas
- // ---------------------------------------------------------------------------
-
- SInt16
- CPigLatinBehavior::DoQDTxMeas(
- CGrafPtr inOrigPort,
- SInt16 inByteCount,
- Ptr inTextAddr,
- Point * inNumer,
- Point * inDenom,
- FontInfo * inInfo)
- {
- StHandleBlock pigLatinText(0, true, true);
- ConvertTextToPigLatin(inTextAddr, inByteCount, pigLatinText);
-
- {
- StHandleLocker locker(pigLatinText);
- UInt32 newByteCount = ::GetHandleSize(pigLatinText);
- return COffscreenBehavior::DoQDTxMeas(inOrigPort, newByteCount, *pigLatinText, inNumer, inDenom, inInfo);
- }
- }
-
-
- // ---------------------------------------------------------------------------
- // • ShouldEnableRestoreMenu
- // ---------------------------------------------------------------------------
-
- Boolean
- CPigLatinBehavior::ShouldEnableRestoreMenu(void)
- {
- return false;
- }
-
-